//
//  HttpTokenAction.m
//  EPBPro
//
//  Created by wucha on 2018/8/1.
//  Copyright © 2018年 fc. All rights reserved.
//

#import "HttpTokenAction.h"


@implementation HttpTokenAction

+(void)postTokenList:(NSDictionary*)dic block:(HTTPResultBlock)block{
    NSString *requestString = [Utils getUrlWithAction:ActionTokenAddress parmasAndKeys:nil];
    [self postRequestWithRequest:requestString withParam:dic jsonSelector:@selector(getTokenListResultWithResponseData:) finish:block];
}

+(void)postAddTokenAddress:(AddTokenAddressActionInfo*)addTokenAddressActionInfo block:(HTTPResultBlock)block{
    NSString *requestString = [Utils getUrlWithAction:ActionAddTokenAddress parmasAndKeys:nil];
    NSDictionary *params = [Utils objectToDictionary:addTokenAddressActionInfo];
    [self postRequestWithRequest:requestString withParam:params jsonSelector:@selector(getAddTokenResultWithResponseData:) finish:block];
}

+(void)postTokenWithDraw:(TokenWithDrawActionInfo*)tokenWithDrawActionInfo block:(HTTPResultBlock)block{
    NSString *requestString = [Utils getUrlWithAction:ActionTokenWithdraw parmasAndKeys:nil];
    NSDictionary *params = [Utils objectToDictionary:tokenWithDrawActionInfo];
    [self postRequestWithRequest:requestString withParam:params jsonSelector:@selector(getTokenWithDrawResultWithResponseData:) finish:block];


}

+(void)postSearchToken:(HTTPResultBlock)block{
    NSString *requestString = [Utils getUrlWithAction:ActionSearchToken parmasAndKeys:nil];
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    UserInfo *usrInfo = [Utils getUserInfo];
    [params setObject:usrInfo.id forKey:@"userId"];
    [params setObject:@"key" forKey:@"accountType"];
    
    [self postRequestWithRequest:requestString withParam:params jsonSelector:@selector(getSearchTokenResultWithResponseData:) finish:block];
    
}

+(void)postTransHistory:(NSDictionary*)dic block:(HTTPResultBlock)block{
    NSString *requestString = [Utils getUrlWithAction:ActionGetTransHistory parmasAndKeys:nil];
    [self postRequestWithRequest:requestString withParam:dic jsonSelector:@selector(getTransTokenResultWithResponseData:) finish:block];
}



+(void)postChangeTokenStatus:(TokenStatusActionInfo*)tokenStatusActionInfo block:(HTTPResultBlock)block{
    NSString *requestString = [Utils getUrlWithAction:ActionChangeTokenStatus parmasAndKeys:nil];
    NSDictionary *params = [Utils objectToDictionary:tokenStatusActionInfo];
    [self postRequestWithRequest:requestString withParam:params jsonSelector:@selector(getChangeTokenStatusResultWithResponseData:) finish:block];
}

+(void)postTokenDeBlockingHistory:(NSDictionary*)dic block:(HTTPResultBlock)block{
    NSString *requestString = [Utils getUrlWithAction:ActionDeBlockingList parmasAndKeys:nil];
    [self postRequestWithRequest:requestString withParam:dic jsonSelector:@selector(getTransTokenResultWithResponseData:) finish:block];
    
}

+(void)postCancelDeblocking:(NSString*)txId block:(HTTPResultBlock)block{
    NSString *requestString = [Utils getUrlWithAction:ActionCancelDeBlock parmasAndKeys:nil];
    NSDictionary *params = @{@"unlockingTxnId":txId};
    [self postRequestWithRequest:requestString withParam:params jsonSelector:@selector(getCancelDeBlockingResultWithResponseData:) finish:block];

}

@end
